<template>
  <DetailPage v-bind="DetailConfig" :model="nowData"></DetailPage>
</template>

<script setup lang="ts">
import apiMod from '@/apiMod'
import { getAreaObj } from '@/utils/util'
import DetailPage from '@/views/aplid/DetailPage/index.vue'
import { DetailConfig } from '../../config'
import { useCommonStore } from '@/stores/common'

const {setLoading} = useCommonStore()
const nowRowData: any = inject('nowRowData')
const nowData: any = ref({})

const props = defineProps({
	chainViewInfo:{
		type:Object,
		default:()=>({})
	},
	isBlockchain:{
		type:Boolean,
		default:false
	}
})
const getInitData = () => {
  setLoading()
	apiMod.view_dpServiceOrgBase_view(nowRowData.id).then((res) => {
		const areaNames: any = getAreaObj(res.data, '', 'set')
		const nowAreaObj: any = getAreaObj(res.data, 'now', 'set')
		nowData.value = {
			...res.data,
			areas_name: areaNames.names,
			nowAreasNames: nowAreaObj.names,
		}
    setLoading()
	})
}

onMounted(() => {
	if(props.isBlockchain){
		nowData.value = props.chainViewInfo
	}else{
		getInitData()
	}
})
</script>

<style scoped>
.detail-label {
	color: #eee;
}

.image {
	width: 90%;
	height: 220px;
	display: block;
}
</style>
